// ml:run = $bin < input
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;
int n, q;
int ex[2][1000010];
int main()
{
    memset(ex, 0, sizeof(ex));
    freopen("adjustment.in", "r", stdin);
    freopen("adjustment.out", "w", stdout);
    scanf("%d%d", &n, &q);
    long long sumr, sumc;
    sumr=sumc=(1LL+n)*n/2;
    long long cntr, cntc;
    cntr=cntc=n;
    for (int i=0;i<q;i++){
        char str[10];
        int k;
        scanf("%s%d", str,&k);
        if (str[0]=='R'){
            if (ex[0][k]){
                printf("0\n");
                continue;
            }
            long long ans=cntc*k+sumc;
            sumr-=k;
            cntr--;
            ex[0][k]=1;
            printf("%lld\n", ans);
        }
        else{
            if (ex[1][k]){
                printf("0\n");
                continue;
            }
            long long ans=cntr*k+sumr;
            sumc-=k;
            cntc--;
            ex[1][k]=1;
            printf("%lld\n", ans);
        }
    }
}

